﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="jslinttoolkit._default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Ext4JSLint</title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:PageManager AutoSizePanelID="BorderLayout1" runat="server"></ext:PageManager>
    <ext:BorderLayout ID="BorderLayout1" ShowBorder="false" runat="server">
        <Regions>
            <ext:Region ID="Region1" Height="60px" ShowBorder="false" ShowHeader="false" Position="Top"
                Layout="Fit" runat="server">
                <Toolbars>
                    <ext:Toolbar ID="Toolbar1" Position="Bottom" runat="server">
                        <Items>
                            <ext:Button ID="btnExpandAll" IconUrl="~/images/expand-all.gif" Text="Expand All"
                                EnablePostBack="false" runat="server">
                            </ext:Button>
                            <ext:Button ID="btnCollapseAll" IconUrl="~/images/collapse-all.gif" Text="Collapse All"
                                EnablePostBack="false" runat="server">
                            </ext:Button>
                            <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
                            </ext:ToolbarSeparator>
                            <ext:Button ID="btnCriticalErrors" IconUrl="~/images/exclamation.png" Text="Only Critical Errors"
                                OnClick="btnCriticalErrors_Click" EnablePress="true" runat="server">
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </Toolbars>
                <Items>
                    <ext:ContentPanel ShowBorder="false" ShowHeader="false" BodyStyle="background-color:#1C3E7E;"
                        ID="ContentPanel1" runat="server">
                        <div style="font-size: 20px; color:White; font-weight:bold; padding: 3px 10px; ">
                            <a href="./default.aspx" style="color:White;">Ext4JSLint</a>
                        </div>
                    </ext:ContentPanel>
                </Items>
            </ext:Region>
            <ext:Region ID="regionLeft" Split="true" Width="200px" ShowHeader="false" EnableCollapse="true"
                Layout="Fit" Position="Left" runat="server">
                <Items>
                    <ext:Tree runat="server" ID="Tree1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
                        EnableArrows="true" OnNodeCommand="Tree1_NodeCommand">
                    </ext:Tree>
                </Items>
            </ext:Region>
            <ext:Region ID="regionCenter" ShowHeader="false" Position="Center" Layout="Fit" runat="server">
                <Items>
                    <ext:Grid ID="Grid1" runat="server" ShowBorder="false" ShowHeader="false" EnableCheckBoxSelect="false"
                        EnableRowNumber="false" EnableMultiSelect="false" OnRowDataBound="Grid1_RowDataBound"
                        OnPreRowDataBound="Grid1_PreRowDataBound" Title="Grid">
                        <Columns>
                            <ext:BoundField DataField="line" Width="45px" HeaderText="Line" />
                            <ext:BoundField DataField="reason" ExpandUnusedSpace="true" HeaderText="Reason" />
                        </Columns>
                    </ext:Grid>
                </Items>
            </ext:Region>
            <ext:Region ID="regionRight" ShowHeader="false" Split="true" IFrameUrl="./source.htm"
                EnableIFrame="true" IFrameName="main" Position="Right" Width="400px" runat="server">
            </ext:Region>
        </Regions>
    </ext:BorderLayout>
    </form>

    <script type="text/javascript">
        function onReady() {

            //            expandCollapseTree();

            selectGridRow();
        }

        //        function expandCollapseTree() {
        //            var tree = Ext.getCmp("<%= Tree1.ClientID %>");

        //            var btnExpandAll = Ext.getCmp("<%= btnExpandAll.ClientID %>");
        //            btnExpandAll.on("click", function() {
        //                tree.expandAll();
        //            });

        //            var btnCollapseAll = Ext.getCmp("<%= btnCollapseAll.ClientID %>");
        //            btnCollapseAll.on("click", function() {
        //                tree.collapseAll();
        //            });
        //        }

        function selectGridRow() {
            var grid = Ext.getCmp("<%= Grid1.ClientID %>");

            grid.getSelectionModel().on("rowselect", function(sm, rowIndex, record) {
                getMainWindow().highlight(parseInt(record.json[0].replace(/<.*?>/g, "")));
            });
        }

        function getMainWindow() {
            return Ext.query("iframe[name=main]")[0].contentWindow;
        }
    
    </script>

</body>
</html>
